home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / circuits / irsim_ta.z / irsim_ta / irsim / src / ana11 / zoom.c < prev   
Encoding:
C/C++ Source or Header  |  1990-09-13  |  1.7 KB  |  59 lines

  1. /*
  2.  *     ********************************************************************* 
  3.  *     * Copyright (C) 1988, 1990 Stanford University.                     * 
  4.  *     * Permission to use, copy, modify, and distribute this              * 
  5.  *     * software and its documentation for any purpose and without        * 
  6.  *     * fee is hereby granted, provided that the above copyright          * 
  7.  *     * notice appear in all copies.  Stanford University                 * 
  8.  *     * makes no representations about the suitability of this            * 
  9.  *     * software for any purpose.  It is provided "as is" without         * 
  10.  *     * express or implied warranty.  Export of this software outside     * 
  11.  *     * of the United States of America may require an export license.    * 
  12.  *     *********************************************************************
  13.  */
  14.  
  15. #include "ana.h"
  16. #include "ana_glob.h"
  17.  
  18.  
  19. public void Zoom( what )
  20.   char  *what;
  21.   {
  22.     int  start, steps;
  23.  
  24.     switch( *what )
  25.       {
  26.     case 'i' :                /* zoom in */
  27.         steps = tims.steps / 2;
  28.         if( steps < 10 )
  29.         steps = 10;
  30.         start = tims.start + steps / 2;
  31.         if( start > tims.last )
  32.           {
  33.         start = tims.last - steps / 2;
  34.         if( start < tims.first )
  35.             start = tims.first;
  36.           }
  37.         break;
  38.  
  39.     case 'o' :                /* zoom out */
  40.         steps = tims.steps * 2;
  41.         start = tims.start - tims.steps / 2;
  42.         if( start < tims.first )
  43.         start = tims.first;
  44.         if( steps > max_time or (start + steps) > max_time )
  45.         return;
  46.         break;
  47.       }
  48.  
  49.     if( tims.steps != steps )
  50.       {
  51.     tims.start = start;
  52.     tims.steps = steps;
  53.     tims.end = start + steps;
  54.     RedrawTimes();
  55.     UpdateScrollBar();
  56.      DrawTraces( start, tims.end );
  57.      }
  58.   }
  59.